import 'package:flutter/material.dart';

import '../../config/public_color.dart';

/// FileName remove_padding_scaffold
///
/// @Author lax
/// @Date 2024/2/20
///
/// @Description

class RemovePaddingScaffold extends StatelessWidget {
  /// 是否移除边距 默认true
  final bool removePadding;

  final bool removeLeft;
  final bool removeTop;
  final bool removeRight;
  final bool removeBottom;

  late final Color? backgroundColor;

  final PreferredSizeWidget? appBar;

  final Widget? body;

  final Widget? floatingActionButton;

  final bool? resizeToAvoidBottomInset;

  final Widget? bottomNavigationBar;

  final Widget? bottomSheet;

  final Widget? drawer;

  final Widget? endDrawer;

  RemovePaddingScaffold({
    super.key,
    this.removePadding = true,
    this.removeLeft = false,
    this.removeTop = true,
    this.removeRight = false,
    this.removeBottom = false,
    Color? backgroundColor,
    this.appBar,
    this.body,
    this.floatingActionButton,
    this.resizeToAvoidBottomInset,
    this.bottomNavigationBar,
    this.bottomSheet,
    this.drawer,
    this.endDrawer,
  }) {
    this.backgroundColor = backgroundColor ?? PublicColor.background;
  }

  @override
  Widget build(BuildContext context) {
    if (removePadding) {
      return MediaQuery.removePadding(
        context: context,
        removeLeft: removeLeft,
        removeTop: removeTop,
        removeRight: removeRight,
        removeBottom: removeBottom,
        child: scaffold(),
      );
    }
    return scaffold();
  }

  Widget scaffold() {
    return Scaffold(
      backgroundColor: backgroundColor,
      appBar: appBar,
      body: body,
      floatingActionButton: floatingActionButton,
      resizeToAvoidBottomInset: resizeToAvoidBottomInset,
      bottomNavigationBar: bottomNavigationBar,
      bottomSheet: bottomSheet,
      drawer: drawer,
      endDrawer: endDrawer,
    );
  }
}
